package mattkrutsick.android.fitnesstracker;

import android.database.sqlite.SQLiteDatabase;

public class DBhelp {

	
	private String table_name;
	private SQLiteDatabase db=null;
	
	
	public DBhelp(SQLiteDatabase db, String table_name){
		db=this.db;
		table_name=this.table_name;
	}
	
	
	public void createTable(String table_name){
		db.execSQL("CREATE TABLE IF NOT EXISTS '"+table_name+"(EXERCISE VARCHAR, WEIGHT INT(4), REPS INT(4)");
	}
	
	public void insertRow(String table_name, String name, int weight, int reps){
		db.execSQL("INSERT INTO '"+table_name+"' VALUES('"+name+"','"+weight+"','"+reps+"');");
	}
	
	public void updateValue(String table_name,  String column, int value, String exercise){
		db.execSQL("UPDATE '"+table_name+"' SET '"+column+"' = '"+value+"' WHERE EXERCISE='"+exercise+"');");
	}
	
	public void updateExercise(String table_name,  String column, String value, String exercise){
		db.execSQL("UPDATE '"+table_name+"' SET EXERCISE = '"+value+"' WHERE EXERCISE='"+exercise+"');");
	}
	
	public String getName(){
		return table_name;
	}
	
	public SQLiteDatabase getDB(){
		return db;
	}
	
	
	
}
